<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="formPersonalTrainerData" prependId="false"  >
		<script type="text/javascript" src="#{request.contextPath}/css/script/script.js"/>

		<h:panelGrid  columns="2" style="width:90%"  columnClasses="top-align,top-align"   >   
			<h:column >
				<h:panelGrid columns="2" cellpadding="2" > 
		            			
		            <h:outputLabel value="#{msgs.Email} :" for="personalTrainerEmail" />
		            <p:inputText id="personalTrainerEmail" value="#{personalTrainerBean.personalTrainer.user.email}" maxlength ="50" size="50" required="true" requiredMessage="#{msgs.EmailObligatory}"/>

					<h:outputLabel value="#{msgs.Password} :"	for="personalTrainerPassword" />
					<p:password id="personalTrainerPassword" autocomplete="off"	redisplay="true"
						value="#{ personalTrainerBean.personalTrainer.user.password}" maxlength="15"	size="15" required="true" requiredMessage="#{msgs.PasswordObligatory}"/>
		
		            <h:outputLabel value="#{msgs.FirstName} :" for="personalTrainerFirstName"  />
		            <p:inputText id="personalTrainerFirstName"    value="#{personalTrainerBean.personalTrainer.firstName}" maxlength ="20" size="20" required="false"  requiredMessage="{msgs.PersonalTrainerNameObligatory"/>

		            <h:outputLabel value="#{msgs.Surname} :" for="personalTrainerSurname"  />
		            <p:inputText id="personalTrainerSurname"    value="#{personalTrainerBean.personalTrainer.lastName}" maxlength ="50" size="50" required="false"  requiredMessage="{msgs.PersonalTrainerSurnameObligatory"/>

		            <h:outputLabel value="#{msgs.Phone} :" for="personalTrainerPhone" styleClass="sp_celphones" />
		            <p:inputText id="personalTrainerPhone" 	value="#{personalTrainerBean.personalTrainer.user.phone}" maxlength ="22" size="22" styleClass="sp_celphones"  />
		
		            <h:outputLabel value="#{msgs.CNPJ} :" for="personalTrainerCnpj" />
		            <p:inputText id="personalTrainerCnpj" 	value="#{personalTrainerBean.personalTrainer.cnpj}" maxlength ="22" size="22" required="false"  styleClass="cnpj"  requiredMessage="#{msgs.CnpjObligatory}"   />

		            <h:outputLabel value="#{msgs.CPF} :" for="personalTrainerCpf" />
		            <p:inputText id="personalTrainerCpf" 	value="#{personalTrainerBean.personalTrainer.cpf}" maxlength ="22" size="22" required="false"  styleClass="cpf" requiredMessage="#{msgs.CpfObligatory}"   />

	   	        	<h:outputLabel value="#{msgs.Gender} :" for="personalTrainerMale" />
		            <p:selectOneMenu id="personalTrainerMale" value="#{personalTrainerBean.personalTrainer.male}"  >
		                <f:selectItem itemLabel="#{msgs.Male}"  	itemValue="true"   />
		                <f:selectItem itemLabel="#{msgs.Female}"	itemValue="false" />
		            </p:selectOneMenu>
	
	    	        <h:outputLabel value="#{msgs.State} :" for="personalTrainerState" />
		            <p:inputText id="personalTrainerState" value="#{personalTrainerBean.personalTrainer.state}" maxlength ="30" size="30" />

	    	        <h:outputLabel value="#{msgs.City} :" for="personalTrainerCity" />
		            <p:inputText id="personalTrainerCity" value="#{personalTrainerBean.personalTrainer.state}" maxlength ="30" size="30" />
		
	    	        <h:outputLabel value="#{msgs.Adrress} :" for="personalTrainerAddress" />
		            <p:inputText id="personalTrainerAddress" value="#{personalTrainerBean.personalTrainer.address}" maxlength ="50" size="50" />
			
	    	        <h:outputLabel value="#{msgs.CEP} :" for="personalTrainerPostalCode" />
		            <p:inputText id="personalTrainerPostalCode" value="#{personalTrainerBean.personalTrainer.postalCode}" maxlength ="12" size="12"/>
	
	    	        <h:outputLabel value="#{msgs.DefaultTheme} :" for="personalTrainerTheme" />

					<p:selectOneMenu id="personalTrainerTheme" value="#{personalTrainerBean.personalTrainer.theme}" converter="#{themeConverter}" validator="#{themeValidator.validate}" var="t" style="width:165px;text-align:left">  
                        <f:selectItems value="#{personalTrainerBean.advancedThemes}" var="theme" itemLabel="#{theme.name}" itemValue="#{theme}"  />
			            <p:column>
			                <p:graphicImage value="/css/images/themes/#{t.image}"/>
			            </p:column>
			            <p:column>
			                #{t.name}
			            </p:column>
			        </p:selectOneMenu>

		            <h:outputText value="#{msgs.Status} :"  rendered="#{p:ifAnyGranted('ROLE_ADMIN')}" />
		            <p:selectOneRadio value="#{personalTrainerBean.personalTrainer.user.active}" rendered="#{p:ifAnyGranted('ROLE_ADMIN')}" >
		                <f:selectItem itemLabel="#{msgs.Active}"  	itemValue="true"   />
		                <f:selectItem itemLabel="#{msgs.Inactive}"	itemValue="false" />
		            </p:selectOneRadio>
	
					<h:outputLabel 	value="#{msgs.CreatedAt} :"		for="personalTrainerCreatedAt" rendered="#{personalTrainerBean.personalTrainer.id != null}"  />
					<p:inputText  	id="personalTrainerCreatedAt" 	value="#{personalTrainerBean.personalTrainer.user.createdAt}" disabled="true"  rendered="#{personalTrainerBean.personalTrainer.id != null}"  >
						<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
					</p:inputText>
	
					<h:outputLabel 	value="#{msgs.ChangedAt} :"		for="personalTrainerChangedAt"  rendered="#{personalTrainerBean.personalTrainer.id != null}"  />
					<p:inputText  	id="personalTrainerChangedAt" 	value="#{personalTrainerBean.personalTrainer.user.lastChange}" disabled="true" rendered="#{personalTrainerBean.personalTrainer.id != null}" >
						<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" rendered="#{personalTrainerBean.personalTrainer.id != null}" />
					</p:inputText>
	
					<h:outputLabel 	value="#{msgs.ExpireOn} :"		for="personalTrainerExpireOn" rendered="#{p:ifAnyGranted('ROLE_ADMIN')}" />
					<p:calendar		id="personalTrainerExpireOn"	value="#{personalTrainerBean.personalTrainer.user.expireOn}"	navigator="true" yearRange="c-10:c+10"
						locale="pt"		timeZone="Brazil/East" selectOtherMonths="true" readOnlyInputText="true" readonlyInput="true" required="true" requiredMessage="#{msgs.ExpireOnObligatory}" 
						rendered="#{p:ifAnyGranted('ROLE_ADMIN')}"  />
	
				</h:panelGrid>
			</h:column>
			<h:column>
				<p:panel header="#{msgs.PersonalTrainerLogotypes}" style="margin-top:5px;margin-left:50px;width:500px">
					<p:imageSwitch effect="fade" widgetVar="switcher" slideshowAuto="false"    >  
						<div align="center" style="width:100%">
							<h3>
								<h:outputText value="#{msgs.PersonalPhoto} (120x100px)" />
							</h3>
							
							<p:commandLink oncomplete="wdlgupload.show();" process="@this"  >
								<p:graphicImage  id="photoPersonalTrainer"  title="#{msgs.Photo} 120px x 100px"  cache="false" 	
									url="#{personalTrainerBean.personalTrainer.photo.folder}#{personalTrainerBean.personalTrainer.photo.location}" height="120px" width="100px" style="border:1px solid;"/>
									<f:setPropertyActionListener  value="#{3}" target="#{personalTrainerBean.uploadType}" />
							</p:commandLink>
						</div>
						<div align="center" style="width:100%">
							<h3>
								<h:outputText value="#{msgs.Logotype} 1 (120x100px)" />
							</h3>
							<p:commandLink oncomplete="wdlgupload.show();" process="@this"  >
								<p:graphicImage id="logoPersonalTrainer"   	title="#{msgs.Logotype} 120px x 100px"  cache="false" 	
									url="#{personalTrainerBean.personalTrainer.logo.folder}#{personalTrainerBean.personalTrainer.logo.location}" height="120px" width="100px" style="border:1px solid;"/>
								<f:setPropertyActionListener  value="#{1}" target="#{personalTrainerBean.uploadType}" />
							</p:commandLink>
							<br/>
						</div>
						<div align="center" style="width:100%">
							<h3>
								<h:outputText value="#{msgs.Logotype} 2 (80x250px)" />
							</h3>
							<p:commandLink oncomplete="wdlgupload.show();" process="@this" >
								<p:graphicImage id="wideLogoPersonalTrainer"  	title="#{msgs.Logotype} 80 x 250px" 	cache="false" 		
									url="#{personalTrainerBean.personalTrainer.logo.folder}#{personalTrainerBean.personalTrainer.wideLogo.location}"	height="80px" width="250px" style="border:1px solid;" /> 
								<f:setPropertyActionListener  value="#{2}" target="#{personalTrainerBean.uploadType}"/>
							</p:commandLink>
						</div>
					</p:imageSwitch>
					<div align="right" style="width:100%">
						<p:commandButton title="#{msgs.Previous}" type="button" onclick="switcher.previous();" styleClass="ui-button-icon-only" 
				               icon="ui-icon-circle-triangle-w" style="width:15px;height:15px;padding:0px;margin:0px"/>  
						<p:commandButton title="#{msgs.Next}" type="button" onclick="switcher.next();"  styleClass="ui-button-icon-only" 
				            icon="ui-icon-circle-triangle-e" style="width:15px;height:15px;padding:0px;margin:0px"/> 
					</div>
				</p:panel>
			</h:column>
		</h:panelGrid>	
		<div align="left"   >
			<p:commandButton  value="#{msgs.Save}"		action="#{personalTrainerBean.savePersonalTrainer}"		
				ajax="true"	update=":growl,:content,:listPersonalTrainerForm"		icon="ui-icon-disk"	rendered="#{personalTrainerBean.personalTrainer.id != null}" />
			<p:commandButton  value="#{msgs.Create}"	action="#{personalTrainerBean.createPersonalTrainer}"	
				ajax="true"	update=":growl,:content,:listPersonalTrainerForm"		icon="ui-icon-document"	rendered="#{personalTrainerBean.personalTrainer.id == null}" />
			<p:spacer width="50px"/>	
			<p:commandButton  value="#{msgs.Cancel}"	action="#{personalTrainerBean.cancelChange}"	icon="ui-icon-cancel"/>
		</div>
	</h:form>
</html>